<?php
// var_dump($_FILES);
if($_FILES['img']['error'] != 0){
	echo '错误：' . $_FILES["img"]["error"];
	return;
}
// $newName = uniqid();
// echo $newName;
if(file_exists('../upload/'.$_FILES['img']['name'])){
	echo '文件已经存在';
	return;
}

if(move_uploaded_file($_FILES['img']['tmp_name'], '../upload/'.$_FILES['img']['name'])){
	echo '../upload/'.$_FILES['img']['name'];
} else {
	echo '文件上传失败';
}